package org.msfj.common.model;

import java.util.ArrayList;
import java.util.List;

public class PageList<T> {


    public PageList(Page page, List<T> list) {
        this.page = page;
        this.list = list;
    }

    private Page page;
    private List<T> list = new ArrayList<>();
    private long total;


    public PageList setTotal(long total) {
        this.total = total;
        return this;
    }

    public long getTotal() {
        return total;
    }

    public int getTotalPage() {
        return (int) ((total + page.getPageSize()) / page.getPageSize());
    }


    public Page getPage() {
        return page;
    }

    public void setPage(Page page) {
        this.page = page;
    }

    public List<T> getList() {
        return list;
    }
}
